package net.butfly.albacore.criteria;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

public class Criteria implements Serializable {
	private static final long serialVersionUID = 4775216639071589206L;
	public static final String PAGE_PROPERTY = "page";

	// public static final String MIN_RECORD_INDEX = "_PAGE_MIN_ROW_NUM";
	// public static final String MAX_RECORD_INDEX = "_PAGE_MAX_ROW_NUM";

	public Criteria() {};

	public Criteria(String schema) {
		this.params.put("_schema", schema);
	}

	protected Map<String, Object> params = new HashMap<String, Object>();

	public Criteria setPage(Page page) {
		this.params.put(PAGE_PROPERTY, page);
		// this.params.put(MIN_RECORD_INDEX, page.getStart() + 1);
		// this.params.put(MAX_RECORD_INDEX, page.getStart() + page.getSize());
		return this;
	}

	public Criteria setParameters(Map<String, ?> params) {
		this.params.putAll(params);
		return this;
	}

	public Criteria set(String key, Object value) {
		this.params.put(key, value);
		return this;
	}

	public Map<String, Object> getParameters() {
		return this.params;
	}
}
